class Solution:
    def minIncrementForUnique(self, A: list) -> int:
        if len(A) == 0:
            return 0
        res = 0
        A.sort()
        next_move = A[0]
        for num in A:
            res += max(0, next_move - num)
            next_move = max(num + 1, next_move + 1)
        return res
